package com.example.mapper;

import com.example.pojo.Order;
import com.example.pojo.OutputMater;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface OrderMapper {
    Long count(int materialID, int quantity, String status, LocalDate begin, LocalDate end);

    List<Order> page(Integer start, Integer pageSize, int materialID, int quantity, String status, LocalDate begin, LocalDate end);
@Insert("insert into purchaseOrders (supplierID,orderDate,materialID,quantity,status) values (#{supplierID},#{orderDate},#{materialID},#{quantity},#{status})")
    void add(Order order);

    void deletes(List<Integer> ids);
@Update("update purchaseOrders set status = #{status} where orderID=#{orderID}")
    void finishOrder(Order order);
@Insert("insert into output_m (orderID,materialID,quantity,total,date) values (#{orderID},#{materialID},#{quantity},#{total},#{date})")
    void add_order(OutputMater outputMater);
}
